package com.ileaf.chromosphere;

import java.util.*;

/**
 * @author Lianlb
 * @since 2019-11-14 20:49
 */
public class UiMain {

    private static final int REDS = 33;
    private static final int BLUES = 16;
    private static final int RED_DRAW_LOTTERY_TIMES = 6;
    private static List<Integer> redContainer = new ArrayList<>();
    private static List<Integer> blueContainer = new ArrayList<>();

    public static void main(String[] args) {
        getRedSphere();
        getBlueSphere();
    }

    public static String getRedSphere() {
        for (int i = REDS; i > 0; i--) {
            redContainer.add(i);
        }
        System.out.println("################## 开始摇红球 ##################");
        int cr = 0;
        int[] red6 = new int[6];
        while (cr < RED_DRAW_LOTTERY_TIMES) {
            // 关键算法，决定红球开出
            int r = new Random().nextInt(REDS - cr);
            // END
            int red = redContainer.get(r);
            redContainer.remove(Integer.valueOf(red));
            red6[cr] = red;
            cr++;
        }
        System.out.println("红球中奖号码以此开出：" + Arrays.toString(red6));
        redContainer.clear();
        return Arrays.toString(red6);
    }

    public static String getBlueSphere() {
        System.out.println("################## 开始摇蓝球 ##################");
        for (int i = BLUES; i > 0; i--) {
            blueContainer.add(i);
        }
        // 关键算法，决定蓝球开出
        int b = new Random().nextInt(BLUES);
        // END
        int blue = blueContainer.get(b);
        System.out.println("蓝球中奖号码：" + blue);
        blueContainer.clear();
        return blue + "";
    }
}
